package com.basic.business.order.controller;


import java.util.List;
import java.io.IOException;
import org.springframework.security.access.prepost.PreAuthorize;
import javax.annotation.Resource;
import com.basic.common.annotation.FileExport;
import com.basic.common.utils.easyExcel.EasyExcelUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.basic.common.annotation.Log;
import com.basic.common.core.controller.BaseController;
import com.basic.common.core.domain.AjaxResult;
import com.basic.common.enums.BusinessType;
import com.basic.business.order.domain.TOrdersLog;
import com.basic.business.order.service.ITOrdersLogService;
import com.basic.common.core.page.TableDataInfo;

/**
 * 业务-订单日志Controller
 * 
 * @author zhaoxy_jn@163.com
 */
@RestController
@RequestMapping("/business/ordersLog")
public class TOrdersLogController extends BaseController
{
    @Resource
    private ITOrdersLogService tOrdersLogService;

    /**
     * 查询业务-订单日志列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TOrdersLog tOrdersLog)
    {
        List<TOrdersLog> list = tOrdersLogService.getList(tOrdersLog);
        return getDataTable(list);
    }

    /**
     * 导出业务-订单日志列表
     */
    @Log(title = "业务-订单日志", businessType = BusinessType.EXPORT)
    @FileExport(fileName = "业务-订单日志.xlsx")
    @PostMapping("/export")
    public String export(TOrdersLog tOrdersLog) throws IOException
    {
        List<TOrdersLog> list = tOrdersLogService.getList(tOrdersLog);
        return EasyExcelUtils.excelExport(TOrdersLog.class,"业务-订单日志数据", list);
    }

    /**
     * 获取业务-订单日志详细信息
     */
    @PreAuthorize("@ss.hasPermi('business:ordersLog:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(tOrdersLogService.get(id));
    }

    /**
     * 新增业务-订单日志
     */
    @PreAuthorize("@ss.hasPermi('business:ordersLog:add')")
    @Log(title = "业务-订单日志", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TOrdersLog tOrdersLog)
    {
        return toAjax(tOrdersLogService.insert(tOrdersLog));
    }

    /**
     * 修改业务-订单日志
     */
    @PreAuthorize("@ss.hasPermi('business:ordersLog:edit')")
    @Log(title = "业务-订单日志", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TOrdersLog tOrdersLog)
    {
        return toAjax(tOrdersLogService.update(tOrdersLog));
    }

    /**
     * 删除业务-订单日志
     */
    @PreAuthorize("@ss.hasPermi('business:ordersLog:remove')")
    @Log(title = "业务-订单日志", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(tOrdersLogService.deleteByIds(ids));
    }
}
